<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="common/commonLayout.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:metadata>
        <f:event type="preRenderView" listener="#{language.setUserLocale()}"/>
    </f:metadata>
    <ui:define name="title">${messages.sourceManager_title}</ui:define>
    <ui:define name="content">
        <br>${messages.sources_home_folder}<h:outputText id="rootFolder" value="#{storagesList.nugetHome}"/></br>
        <br>${messages.sourceManager_package_source_count}<h:outputText id="nameText" value="#{storagesList.repositoriesCount}"/></br>
        <h:dataTable value="#{storagesList.storageOptions}" var="repo">
            <h:column>
                <f:facet name="header">№</f:facet>
                <c:choose>
                    <c:when test="#{facesContext.externalContext.isUserInRole('jnuget-admin')}">
                        <h:link value="#{storagesList.storageOptions.rowIndex+1}" outcome="storageOptions">
                            <f:param name="storageId" value="#{repo.storageName}"/>
                        </h:link>
                    </c:when>
                    <c:otherwise>
                        <h:outputText value="#{storagesList.storageOptions.rowIndex+1}"/>
                    </c:otherwise>
                </c:choose>
            </h:column>
            <h:column>
                <f:facet name="header">${messages.sourceManager_package_name}</f:facet>
                <h:outputText value="#{repo.getStorageName()}"/>
            </h:column>
            <h:column>
                <f:facet name="header">${messages.sourceManager_package_source_class}</f:facet>
                <h:outputText value="#{repo.getClassName()}"/>
            </h:column>
            <h:column>
                <f:facet name="header">${messages.sourceManager_is_indexed}</f:facet>
                <h:outputText value='#{repo.isIndexed()?"Y":"N"}'/>
            </h:column>
            <h:column>
                <f:facet name="header">${messages.sourceManager_index_refresh_interval}</f:facet>
                <h:outputText value="#{repo.getRefreshInterval()}" rendered="#{repo.refreshInterval != null and repo.cronString == null}"/>
                <h:outputText value="#{repo.cronString}" rendered="#{repo.cronString != null}"/>
            </h:column>
            <h:column>
                <f:facet name="header">${messages.sourceManager_package_source_content}</f:facet>
                <h:link value="${messages.sourceManager_package_source_content}" outcome="storageContents">
                    <f:param name="storageId" value="#{repo.getStorageName()}"/>
                </h:link>
            </h:column>
        </h:dataTable>
    </ui:define>
</ui:composition>